<?php
session_start();
include("dbconfig.php");
ini_set('max_execution_TIME', 600);
$username=$_POST["username"];
$password=$_POST["password"];
$password=md5($password);


$code="";
for ($i=0;$i<6;$i++){
    $code.=strval(rand(0,9));
    
}
$_SESSION['code']=$code;
$_SESSION['login']=false;
$db = mysql_pconnect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error());
mysql_select_db($database) or die("Error conecting to db.");
$sql="select * from userinfo where username like '$username' and password like '$password'";
$result =mysql_query ($sql);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = mysql_num_rows($result);
if ($count==0){
    
 echo "用户不存在";    

}
else{

$mobile=$row["mobile"];
system("python msg.py '$mobile' '$code' 'reserve'");
echo "发送成功";

}







?>
